/**
 * 此处可直接引用自己项目封装好的 axios 配合后端联调
 */


import axiosInstance from "../../../plugins/axios.ts"

// 获取验证图片以及token
export async function reqGet(data) {
    try {
        const response = await axiosInstance({
            url: '/captcha/get',
            method: 'post',
            data
        })
        
        if(response.data.repCode !="0000") {
            throw new Error(response.data.msg)
        }
        return response.data
    } catch (error) {
        console.error("请求获取验证码出错：", error)
        throw error
    }
}

// 滑动或者点选验证
export async function reqCheck(data) {
    try {
        const response = await axiosInstance({
            url: '/captcha/check',
            method: 'post',
            data
        })
        if(response.data.repCode !="0000") {
            throw new Error(response.data.msg)
        }
        return response.data
    } catch (error) {
        console.error("请求验证出错：", error)
        throw error
    }
}



